package com.ww.nio.filechannel;

import java.nio.IntBuffer;

public class PutDemo {

    static IntBuffer intBuffer = null;

    public static void allocatTest() {
        intBuffer = IntBuffer.allocate(20);
//        System.out.println("position = " + intBuffer.position());
//        System.out.println("limit = " + intBuffer.limit());
//        System.out.println("capacity = " + intBuffer.capacity());
    }

    public static void putTest() {
        for (int i = 0; i < 5; i++) {
            intBuffer.put(i);
        }
        System.out.println("position = " + intBuffer.position());
        System.out.println("limit = " + intBuffer.limit());
        System.out.println("capacity = " + intBuffer.capacity());
    }

    public static void main(String[] args) {
        allocatTest();
        putTest();
    }
}
